<include file="Public/HOME/HTML/head_html_5.html" />
<meta charset="utf-8"/>
<title>{$title}{$Think.const.TITLE}</title>
<include file="Public/HOME/HTML/CssAndJs.html" />
<include file="Public/HOME/HTML/middle_list.html" />
<div class="container-fluid main-content">
	<div class="row">
		<div class="col-md-12">
			<div class="widget-container fluid-height clearfix">
				<div class="heading">
					<i class="icon-tags"></i>活动详情
				</div>
				<div style="width: 80%;margin:10px auto;background-color: rgb(249, 250, 250)">
				<input type="text" hidden="" id="uid" value="{$Think.session.userUid}">
					<p style="font-size: 24px;text-align:center; color: #007aff; font-family: 微软雅黑, 宋体;padding-top:20px">
						{$list.aname}</p>

					<div class="blog-content" >
						<blockquote style="height: 30px;margin: 10px 0 0 0; color: #f09606;font-size:14px;">
											<address >
										    <span class="meta-author" >发布时间：{$list.startdate}</span>&nbsp;&nbsp;
										     <span class="meta-author" >浏览量：{$list.onclink}</span>
											</address>
										</blockquote>

						<div class="as" style="width: 80%;margin:0 auto">
						{$list.content}
						</div>
						<blockquote style="margin: 10px 0 0 0; color: #f09606;font-size:16px">
						<address>
						    <span class="meta-author" style="color: #f09606">活动时间：{$list.startdate}</span>&nbsp;&nbsp;<br>
						     <span class="meta-author" style="color: #f09606">结束时间：{$list.enddate}</span>&nbsp;&nbsp;<br>
						      <span class="meta-author" style="color: #f09606">抢票时间：{$list.bmdate}</span>&nbsp;&nbsp;<br>
							<span class="meta-author" style="color: #f09606">活动地点：{$list.place}</span>&nbsp;<br>
							<span class="meta-author" style="color: #f09606">票数/剩余票数：{$list.totalticket}/<span id="restticket">{$list.restticket}</span></span>&nbsp;<br>

							<span class="meta-author" style="color: #f09606"> 附件下载：<a href="{:U('activity/download',array('aid'=>$list['aid']))}" >{$list.attach}</a></span>

							<if condition="$list['status'] eq '0'">
							<button style="width: 150px;float:right;margin-top:-65px;margin-right:260px" type="button" class="btn btn-primary" id="invest"  disabled="disabled" value="{$Think.session.userUid}">未开始抢票</button>
							</if>
							<if condition="$list['status'] eq '1'">
							<button style="width: 150px;float:right;margin-top:-65px;margin-right:260px" type="button" class="btn btn-primary" id="invest"  value="{$Think.session.userUid}">抢 票 中</button>
							</if>
							<if condition="$list['status'] eq '2'">
							<button style="width: 150px;float:right;margin-top:-65px;margin-right:260px" type="button" class="btn btn-primary" id="invest"  disabled="disabled" value="{$Think.session.userUid}">抢票结束</button>
							</if>
							<button style="width: 150px;float:right;margin-top:-65px;margin-right:260px;display:none" type="button" class="btn btn-primary" id="cancel"  value="{$Think.session.userUid}">取消抢票</button><br/><br/>
						</address>
						</blockquote>
						<!-- /.blog-content -->
						<script type="text/javascript">
						// var uid={$Think.session.userUid};
						var uid=$("#uid").val();
						var aid={$list.aid};
						// alert(uid);

						 $.ajax({
					            type:"get",
					            url:"__CONTROLLER__/isjoin/uid/"+uid+"/aid/"+aid,
					            success:function(data){
					              if(data=='false') {
					                $("#invest").hide();
					                $("#cancel").show();
					              }
						            else{
						            	 $("#invest").show();
					               		 $("#cancel").hide();
						            }
						        }
					          });
						$("#invest").click(function(){
							if(uid){
							 $.ajax({
					            type:"get",
					            url:"__CONTROLLER__/invest/uid/"+uid+"/aid/"+aid,
					            success:function(data){
					              if(data) {
					                alert("抢票成功");
					                $("#restticket").text(data);
					                $("#invest").hide();
					                $("#cancel").show();
					              }
					              else if(data=='false'){
									alert("已抢票");
						            }
						            else{
						            	alert("抢票失败");
						            }
						        }
					          });
							}
							else{
								alert("请登录后投票");
							}

						});
						$("#cancel").click(function(){
							if(uid){
							 $.ajax({
					            type:"get",
					            url:"__CONTROLLER__/cancel/uid/"+uid+"/aid/"+aid,
					            success:function(data){
					            	// alert(data);
					              if(data) {
					              	alert("取消成功");
					              	$("#restticket").text(data);
					                $("#invest").show();
					                $("#cancel").hide();
					              }
						            else{
						            	alert("取消失败");
						            }
						        }
					          });
							}
							else{
								alert("请登录后投票");
							}
						});
						</script>
					</div>
				<!-- /.post-blog -->
			</div>
			</div>
		</div>
	</div>
</div>

<include file="Public/HOME/HTML/footer.html" />
</body>
</html>